package com.example.service.impl;

import com.example.service.SendMailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

//@Service
public class SendMailServiceImpl implements SendMailService {
    @Autowired
    private JavaMailSender javaManager;

    private String senderHost = "2194588563@qq.com";

    private String toMali = "3403911688@qq.com";

    private String title = "测试";

    private String context =  "测试内容" ;


    @Override
    public void sendMail() {
        SimpleMailMessage mimeMessage = new SimpleMailMessage();
        mimeMessage.setFrom(senderHost);
        mimeMessage.setTo(toMali);
        mimeMessage.setSubject(title);
        mimeMessage.setText(context);
        javaManager.send(mimeMessage);
    }
}
